package string;
import java.util.Scanner;

public class VerificationCode {
    public static void main(String[] args) {
        char[] c = new char[4]; //创建四位char数组
        for (int i = 0; i < c.length; i++) {
            String string = "0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ";
            int sum = (int)(Math.random()*string.length()); //随机生成String下标
            c[i] = string.charAt(sum); //截取string给到Char数组
            System.out.print(c[i]);
        }
        System.out.println();
        String s1 = String.valueOf(c);  //将Char数组转为字符串
        s1 = s1.toLowerCase();          //将字符串字母转为小写

        Scanner scanner = new Scanner(System.in);//输入验证码
        String s = scanner.next();
        s = s.trim();                     //防止开头或结尾输入空格字符串
        s = s.toLowerCase();              //输入转小写
        if (s.equals(s1)) {
            System.out.println("验证成功");
        }else {
            System.out.println("验证失败");
        }



    }
}
